package org.openstock.impl.def.charting.ui.swing.model;

import java.util.ArrayList;
import java.util.List;

import org.openstock.api.charting.model.Chart;
import org.openstock.api.charting.model.ChartDataModel;
import org.openstock.impl.def.core.ui.swing.wrapper.JComponent;

public abstract class AbstractSwingChart extends JComponent implements Chart<JComponent> {
	private static final long serialVersionUID = -377671214469301805L;

	private List<JComponent> children = new ArrayList<JComponent>();
	private ChartDataModel<?> chartDataModel;
	
	public void addChild(JComponent child) {
		children.add(child);
	}

	public void removeChild(JComponent child) {
		children.remove(child);
	}
	
	@Override
	public List<JComponent> getChildren() {
		return children;
	}

	@SuppressWarnings("unchecked")
	public ChartDataModel<?> getChartDataModel() {
		return chartDataModel;
	}
	
	public void setChartDataModel(ChartDataModel<?> chartDataModel){
		this.chartDataModel = chartDataModel;
	}

}
